#!/bin/bash
#SBATCH -J GRAPES
#SBATCH -N 4
##SBATCH -n 16
#SBATCH --gres=dcu:4
#SBATCH --mem=100G		#占用节点全部内存
#SBATCH --ntasks-per-node=4	#指定每个节点的进程数
##SBATCH -o %j
##SBATCH -e %J
#SBATCH -o runlog/%J_16.out
##SBATCH -o std.out
#SBATCH -e runlog/%J_16.err
#SBATCH -p normal
##SBATCH -p debug
#SBATCH  --exclusive

#SBATCH -t 00:25:00

echo "Start time: `date`"                               #显示开始时间
echo "SLURM_JOB_ID: $SLURM_JOB_ID"                      #显示作业号
echo "SLURM_NNODES: $SLURM_NNODES"                      #显示节点数
echo "SLURM_NTASKS: $SLURM_NTASKS"                      #显示总任务数
echo "SLURM_TASKS_PER_NODE: $SLURM_TASKS_PER_NODE"      #显示每节点的任务数
echo "SLURM_CPUS_PER_TASK: $SLURM_CPUS_PER_TASK"        #显示每个任务使用的CPU数量
echo "SLURM_JOB_PARTITION: $SLURM_JOB_PARTITION"        #显示队列/分区名称
echo "SLURM_SUBMIT_DIR:$SLURM_SUBMIT_DIR"               #显示提交作业目录的路径
echo "SLURM_NODELIST:$SLURM_NODELIST"                   #显示执行节点列表名称

#module purge
#module load compiler/intel/2017.5.239
#module load mpi/hpcx/2.7.4/intel-2017.5.239
#module load mathlib/netcdf/4.4.1/intel
#module load compiler/dtk/21.10
#module purge

#module load compiler/intel/2017.5.239
#module load mpi/hpcx/2.7.4/intel-2017.5.239
#module load mathlib/netcdf/4.4.1/intel
#module load compiler/rocm/dtk/21.10
#module load compiler/dtk/21.10


srun hostname |sort |uniq -c |awk '{printf"%s slots=%s\n",$2,$1}' > hostfile
#node_num=4
node_num=${SLURM_JOB_NUM_NODES}
#${SLURM_JOB_NUM_NODES}
#echo ${node_num}
#echo ${SLURM_NTASKS} 
#mpirun -bind-to none ./grapes_global.exe
#mpirun --bind-to none run.exe
mpirun -np ${SLURM_NTASKS} --hostfile `pwd`/hostfile --mca plm_rsh_no_tree_spawn 1 --mca plm_rsh_num_concurrent ${node_num}  -mca routed_radix ${node_num} -mca pml ucx -x LD_LIBRARY_PATH -mca coll_hcoll_enable 0 --bind-to none `pwd`/src/dcu_bind.sh
echo "End time: `date`"  #显示结束时间
